#include <iostream>
#include <map>
#include <vector>

using namespace std;

int main()
{
    int M, N;
    cin >> M >> N;
    map<int, int> mp;
    int k = 0;
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < M; j++)
        {
            cin >> k;
            if(mp[k] == 0)
            {
                mp[k] = 1;
            }
            else
            {
                mp[k]++;
            }
        }
    }
    int max = mp.rbegin()->second;
    vector<int> v;
    for (map<int, int>::reverse_iterator i = ++mp.rbegin(); i != mp.rend(); i++)
    {
        if(i->second > max)
        {
            max = i->second;
        }
    }
    for (map<int, int>::iterator i = mp.begin(); i != mp.end(); i++)
    {
        if(i->second == max)
        {
            v.push_back(i->first);
        }
    }
    cout << v[0];
    for (vector<int>::iterator i = ++v.begin(); i != v.end(); i++)
    {
        cout  << ' ' << *i;
    }
}